"""p_bbs URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, re_path
from app01 import views
from django.views.static import serve
from p_bbs import settings

urlpatterns = [
    path('admin/', admin.site.urls),
    path("login/", views.Login.as_view(), name="login"),
    path("valid_check/", views.valid_check, name="valid_check"),
    path("register/", views.Register.as_view(), name="register"),
    path("index/", views.index, name="index"),
    re_path("index/(?P<page>.*)", views.index, name="index"),
    # path("index/<int:page>", views.index, name="index"),
    path("logout/", views.logout, name="logout"),
    re_path("media/(?P<path>.*)", serve, {"document_root": settings.MEDIA_ROOT}),
    re_path("(?P<name>[\w]+)/category/(?P<category_id>[\d]+)", views.user_site, name="category"),
    re_path("(?P<name>[\w]+)/tag/(?P<tag_id>[\d]+)", views.user_site, name="tag"),
    re_path("(?P<name>[\w]+)/archive/(?P<archive_id>.*)", views.user_site, name="tag"),
    re_path("(?P<name>[\w]+)/p/(?P<archive_id>.*)", views.archive_detail, name="tag"),
    re_path("(?P<name>[\w]+)/", views.user_site, name="user_site"),
]
